// //各学校在顶级期刊、重要期刊和其他期刊发表的论文数
// import React, { useState, useEffect } from 'react';
// import ReactDOM from 'react-dom';
// import { Column } from '@ant-design/plots';
//
// const DemoColumn = (props) => {
//   const data = props.data ? props.data: [
//     {"name":"国外期刊","paper":150},
//     {"name":"国内期刊","paper":170},
//     {"name":"其他期刊","paper":180},
//   ]
//   const config = {
//     data,
//     xField: 'name',
//     yField: 'paper',
//     maxColumnWidth:50,
//     yAxis: {
//       label: {
//         style: {
//           fontSize: 16
//         }
//       }
//     },
//     xAxis: {
//       label: {
//         style: {
//           fontSize: 16
//         }
//       }
//     },
//     legend: {
//       position: 'top-left',
//       itemName: {style: {fontSize: 18}},
//     },
//   };
//
//   return <Column {...config} />;
// };
//
// export default DemoColumn

//各学校在顶级期刊、重要期刊和其他期刊发表的论文数
import React, { useState, useEffect } from 'react';
import ReactDOM from 'react-dom';
import { Column } from '@ant-design/plots';

const DemoColumn = (props) => {

  const data = props.data ? props.data : [
    {"school":"2014","jour_level": "顶级期刊","paper":150},
    {"school":"2014","jour_level": "重要期刊","paper":170},
    {"school":"2014","jour_level": "其他期刊","paper":180},

    {"school":"2015","jour_level": "顶级期刊","paper":50},
    {"school":"2015","jour_level": "重要期刊","paper":90},
    {"school":"2015","jour_level": "其他期刊","paper":140},

    {"school":"2016","jour_level": "顶级期刊","paper":100},
    {"school":"2016","jour_level": "重要期刊","paper":70},
    {"school":"2016","jour_level": "其他期刊","paper":80},

    {"school":"2017","jour_level": "顶级期刊","paper":90},
    {"school":"2017","jour_level": "重要期刊","paper":105},
    {"school":"2017","jour_level": "其他期刊","paper":80},

    {"school":"2018","jour_level": "顶级期刊","paper":110},
    {"school":"2018","jour_level": "重要期刊","paper":120},
    {"school":"2018","jour_level": "其他期刊","paper":115},

    {"school":"2019","jour_level": "顶级期刊","paper":70},
    {"school":"2019","jour_level": "重要期刊","paper":150},
    {"school":"2019","jour_level": "其他期刊","paper":100},

    {"school":"2020","jour_level": "顶级期刊","paper":80},
    {"school":"2020","jour_level": "重要期刊","paper":120},
    {"school":"2020","jour_level": "其他期刊","paper":130},

    {"school":"2021","jour_level": "顶级期刊","paper":60},
    {"school":"2021","jour_level": "重要期刊","paper":100},
    {"school":"2021","jour_level": "其他期刊","paper":120},
  ]
  const config = {
    data,
    xField: 'school',
    yField: 'paper',
    seriesField: 'jour_level',
    isGroup: 'true',
    maxColumnWidth:50,
    yAxis: {
      label: {
        style: {
          fontSize: 16
        }
      }
    },
    xAxis: {
      label: {
        style: {
          fontSize: 16
        }
      }
    },
    legend: {
      position: 'top-left',
      itemName: {style: {fontSize: 18}},
    },
  };

  return <Column {...config} />;
};

export default DemoColumn
